package com.pq.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SysResult implements Serializable {
    private Integer status;//状态码，200成功，201失败
    private String msg;//服务器放回的提示信息
    private Object data;//服务器数据
    private static SysResult failResult =
            new SysResult(201,"服务器调用失败",null);//错误返回信息
    private static SysResult successResultWithoutParams =
            new SysResult(200,"服务器执行成功",null);
    //编辑失败方案
    public static SysResult fail(){
        return failResult;
    }
    public static SysResult success(){
        return successResultWithoutParams;
    }
    public static SysResult success(Object data){
        return new SysResult(200,"服务器执行成功",data);
    }
    public static SysResult success(String msg,Object data){
        return new SysResult(200,msg,data);
    }

}
